﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
//using TwitterPlatform.Model;
using System.Collections.ObjectModel;
using System.ComponentModel;
//using TwitterPlatform.Commands;

namespace QplusClassLibrary.ViewModel
{
    public class ContactsListViewModel : IEnumerable<FriendControl>//<Person>
    {

        public ContactsListViewModel()
        {
            //this.LoadedCommand = new ShowMessageCommand<string>(this.DoWorkOnLoaded);
        }

        //public ShowMessageCommand<string> LoadedCommand { get; private set; }


        void DoWorkOnLoaded(string str)
        {
            System.Diagnostics.Debug.WriteLine(">>>>>>>>>>>  loaded" + DateTime.Now.ToShortDateString());
        }

        //GetEnumerator() 加载数据
        public IEnumerator<FriendControl> GetEnumerator()
        {
            var l = new List<FriendControl>(){ 
                        new FriendControl() { },
                        new FriendControl() {  },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { },
                        new FriendControl() { }
                    };
            l.Sort();
            return l.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.GetEnumerator();
        }
    }
}
